<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<head th:replace="common/common.html::common_css">
</head>
<script>
    function getHref(obj) {
        var a = document.getElementById("btn");
        a.href = obj.href;
    }
</script>
<body>
<div th:replace="common/admin_common.html::common_sidebar"></div>
<div class="page">
    <div th:replace="common/admin_common.html::common_navbar"></div>
    <!-- Breadcrumb-->
    <div class="breadcrumb-holder">
        <div class="container-fluid">
            <ul class="breadcrumb">
                <li class="breadcrumb-item"><a th:href="@{/admin/admin_index.html}">主页</a></li>
                <li class="breadcrumb-item active">成绩管理</li>
            </ul>
        </div>
    </div>
    <section>
        <div class="container-fluid">
            <!-- Page Header-->
            <header>
                <h1 class="h3 display">成绩信息</h1>
            </header>
            <div class="row">
                <div class="col-lg-6" style="flex:100%;max-width: 100%">
                    <div class="card">
                        <div class="card-header">
                            <h4>成绩</h4>

                            <div style="width: 100%;height: 100%;text-align: center">
                                <form class="text-left form-validate" th:action="@{/admin/record_qurey.html}" method="post">
                                    <div style="text-align: center !important;">
                                        <div class="form-group-material" style="float: left;margin-left: 35%;top:25px">
                                            <input id="register-username" type="text"
                                                   style="background-color: #fff !important;" name="qureymessage"
                                                   class="input-material">
                                            <label for="register-username" class="label-material">输入关键词查询</label>
                                        </div>
                                        <div class="form-group text-center"
                                             style="float: left;margin-left: 20px;margin-top: 25px">
                                            <input id="register" type="submit" value="查询" class="btn btn-primary"
                                                   style="width: 100%">
                                            <div class="form-group terms-conditions text-center">
                                                <input name="qureyby" class="form-control-custom is-invalid"
                                                       id="qureybynanme" aria-invalid="true"
                                                       aria-describedby="registerAgree-error" type="radio" value="1"
                                                       checked="checked">
                                                <label for="qureybynanme">试卷查询</label>
                                                <input name="qureyby" class="form-control-custom is-invalid"
                                                       id="qureybynumber" aria-invalid="true"
                                                       aria-describedby="registerAgree-error" type="radio" value="0">
                                                <label for="qureybynumber">考生查询</label>
                                            </div>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                        <div class="card-body">
                            <div class="table-responsive">
                                <table class="table">
                                    <thead style="text-align: center">
                                    <tr>
                                        <th>考生号</th>
                                        <th>考生姓名</th>
                                        <th>所属部门</th>
                                        <th>试卷名称</th>
                                        <th>试卷类型</th>
                                        <th>状态</th>
                                        <th>完成时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody style="text-align: center">
                                    <tr th:each="testpaper:${pageInfo.list}">
                                        <td th:text="${testpaper.stuid}"></td>
                                        <td th:text="${testpaper.stuname}"></td>
                                        <td>
                                            <p th:text="${testpaper.apartmentname}"></p>
                                        </td>
                                        <td th:text="${testpaper.testpapername}"></td>
                                        <td>
                                            <p th:if="${testpaper.type}">固定组卷</p>
                                            <p th:if="${not testpaper.type}">随机组卷</p>
                                        </td>
                                        <td>
                                            <p th:if="${(testpaper.score*1.0)/(testpaper.totalscore*1.0) < 0.6}" style="color: red">
                                                不及格</p>
                                            <p th:if="${(testpaper.score*1.0)/(testpaper.totalscore*1.0) >= 0.6 and (testpaper.score*1.0)/(testpaper.totalscore*1.0) < 0.8}"
                                               style="color: darkorange">及格</p>
                                            <p th:if="${(testpaper.score*1.0)/(testpaper.totalscore*1.0) >= 0.8 and (testpaper.score*1.0)/(testpaper.totalscore*1.0) < 0.9}"
                                               style="color: greenyellow">良好</p>
                                            <p th:if="${(testpaper.score*1.0)/(testpaper.totalscore*1.0) > 0.9}"
                                               style="color: limegreen">优秀</p>
                                        </td>
                                        <td th:text="${testpaper.reachtime}"></td>
                                        <td>
                                            <a id="update"
                                               th:href="@{/admin/record_information.html/{id}(id=${testpaper.scoresid})}"
                                               class="btn btn-warning m-b-10 m-1-5" style="border-radius: 4px"
                                               type="button">详情</a>
                                            <a sec:authorize="hasRole('Ctest')" th:href="@{/admin/record_delete.html/{id}(id=${testpaper.scoresid})}"
                                               type="button" onclick="getHref(this)" data-toggle="modal"
                                               data-target="#myModal" class="btn btn-danger m-b-10 m-1-5"
                                               style="border-radius: 4px;margin-left: 5px">删除</a>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                                <!-- Modal-->
                                <div sec:authorize="hasRole('Ctest')" id="myModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
                                     aria-hidden="true" class="modal fade text-left">
                                    <div role="document" class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <h5 id="exampleModalLabel" class="modal-title">确定要删除嘛？</h5>
                                                <button type="button" data-dismiss="modal" aria-label="Close"
                                                        class="close"><span aria-hidden="true">×</span></button>
                                            </div>
                                            <div class="modal-footer"
                                                 style="display: block;padding: 1rem;text-align: center;">
                                                <button type="button" data-dismiss="modal" class="btn btn-secondary">
                                                    取消
                                                </button>
                                                <a id="btn" type="button" class="btn btn-primary"
                                                   style="margin-left: 100px">确定</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div th:replace="common/pageinfosplit.html :: pages_split"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <div th:replace="common/common.html::common_footer"></div>
</div>
<div th:replace="common/common.html::common_js">
</div>
</body>
</html>